package com.fang.networkdisk.config;

import com.fang.networkdisk.filter.LogFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description
 * @Author Bernie_fang
 * @Date 2025/5/27 22:22
 **/
@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean<LogFilter> traceIdFilterRegistration() {
        FilterRegistrationBean<LogFilter> registration = new FilterRegistrationBean<>();
        registration.setFilter(new LogFilter());
        registration.addUrlPatterns("/*"); // 拦截所有路径
        registration.setOrder(1); // 设置过滤器优先级
        return registration;
    }
}